import xlrd
import xlwt

workbook = xlrd.open_workbook(r'C:\\Users\\lyz\\Desktop\\要转的\\员工列表.xls')
sheet_name = workbook.sheet_names()[0]
sheet = workbook.sheet_by_index(0)


#
workbook = xlwt.Workbook(encoding='utf-8')
# 创建一个worksheet
worksheet = workbook.add_sheet('MyWorksheet')


def is_chinese(string):
    for ch in string:
        if u'\u4e00' <= ch <= u'\u9fff':
            return True
    return False


for rown in range(sheet.nrows):
    rows = sheet.row_values(rown)
    for i in range(len(rows)):
        if is_chinese(str(rows[i])) and rown != 0:
            rows[i] = str(rows[i]).encode('GBK').decode('cp850')
        worksheet.write(rown, i, label=rows[i])
# 保存
workbook.save('C:\\Users\\lyz\\Desktop\\导出数据\\员工列表.xls')

